﻿using GN.Pay.TradeChannel.Configure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.TradeChannel.UnionPay
{
    [Serializable]
    public class UnionPayConfigure : ATradeChannelConfigure<UnionPayConfigureInfo>
    {

        public UnionPayConfigure(IChannel channel) :
            base(channel)
        {

        }
        public override string GetOrderQueryErrorMessage(string code)
        {
            throw new NotImplementedException();
        }

        public override string GetPayErrorMessage(string code)
        {
            throw new NotImplementedException();
        }

        public override string GetRefundErrorMessage(string code)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 
        /// </summary>
        protected override string NotifyControllerName
        {
            get
            {
                return "UnionPay";
            }
        }

        /// <summary>
        /// 获取网关Url
        /// </summary>
        public string GateWayUrl
        {
            get
            {
                return "https://gateway.95516.com/gateway/api/frontTransReq.do";
            }
        }

        protected override void SaveCheck(UnionPayConfigureInfo configureInfo)
        {
            CheckNotNull(configureInfo, nameof(configureInfo));
            CheckNotNullOrWhite(configureInfo.AccountId, nameof(configureInfo.AccountId));
            CheckNotNullOrWhite(configureInfo.SignPfxRawBase64, nameof(configureInfo.SignPfxRawBase64));
            CheckNotNullOrWhite(configureInfo.SignPfxPassWord, nameof(configureInfo.SignPfxPassWord));
            CheckNotNullOrWhite(configureInfo.SignVerifyCerRawBase64, nameof(configureInfo.SignVerifyCerRawBase64));

            SecurityUtils.GetSignProvider(configureInfo);
            SecurityUtils.GetSignVerifyProvider(configureInfo);
        }
    }
}
